#include <stdio.h>
#include <math.h>

int main() {
    double x;
    scanf("%lf", &x);

    double cos_value = 1.0;
    double term = 1.0;
    double fact = 1.0;
    int sign = -1;
    
    for (int i = 2; fabs(term) >= 1e-8; i += 2)
	{
        fact *= (i - 1) * i;
        term = sign * pow(x, i) / fact;
        cos_value += term;
        sign = -sign;
    }

    printf("%.6lf\n", cos_value);

    return 0;
}
